﻿using System;
using System.Data;

namespace ControlExplorer.samples.Freezing
{
  public partial class Overview : SpreadDemoPage
  {
    protected void Page_Load(object sender, System.EventArgs e)
    {
      if (IsPostBack)
        return;

      //Generate the dataset
      DataSet ds = new DataSet();
      string f = MapPath("authors.xml");
      ds.ReadXml(f);

      //Load a skin
      //FarPoint.Web.Spread.DefaultSkins.GetAt(13).Apply(FpSpread1.Sheets[0]);
      //FpSpread1.CommandBar.BackColor = Color.Wheat;

      //Bind
      FpSpread1.DataSource = ds;
      FpSpread1.ActiveSheetView.PageSize = 20;
      this.FpSpread1.UseClipboard = false;

    }

    #region Web Form Designer generated code
    override protected void OnInit(EventArgs e)
    {
      //
      // CODEGEN: This call is required by the ASP.NET Web Form Designer.
      //
      InitializeComponent();
      base.OnInit(e);
    }

    /// <summary>
    /// Required method for Designer support - do not modify
    /// the contents of this method with the code editor.
    /// </summary>
    private void InitializeComponent()
    {

    }
    #endregion

    protected void cbCols_SelectedIndexChanged(object sender, System.EventArgs e)
    {
      //Frozen Columns
      FpSpread1.Sheets[0].FrozenColumnCount = cbCols.SelectedIndex; //int.Parse(cbCols.SelectedValue);
    }

    protected void cbRows_SelectedIndexChanged(object sender, System.EventArgs e)
    {
      //Frozen Rows
      FpSpread1.Sheets[0].FrozenRowCount = cbRows.SelectedIndex; //int.Parse(cbRows.SelectedValue);
    }
  }
}